<%@ include file="/header.jsp" %>

<h1>Add new Person</h1>

<form:form commandName="person">

    <p><label for="name">Name</label><br/>
    <form:input path="name"/>
    <form:errors path="name" cssStyle="color: red"/>
    </p>

    <p><label for="surname">Surname</label><br/>
    <form:input path="surname"/>
    <form:errors path="surname" cssStyle="color: red" />
    </p>
	<c:choose>
	<c:when test="${person.updateGranted}">
		<p><input type="submit" value="Save"/></p>				
	</c:when>
	<c:otherwise>
	<p>Edit Not allowed</p>
	</c:otherwise>
	</c:choose>  
    
	<br>
	<!--<p><a href="/lab02-music-portal/music/singer_listall?id=${person.id}"> Singer details </a></p>
	<p><a href="/lab02-music-portal/music/band_listall?id=${person.id}"> Music Band details </a></p>-->
	
	<p>Person's artist info</p>
	<table border="1" width="90%" cellspacing="0" style="margin:10px">
		<tr>
			<td>Id</td>
			<td>
			Name/Title
			</td>
		</tr>
		<tr>
			<td>
			<a href="/lab02-music-portal/music/add_singer?id=${person.singerInfo.id}"> <c:out value="${person.singerInfo.id}"/></a>
			</td>
			<td>
			<c:out value="${person.singerInfo.name}"/>
			</td>
		</tr>
		<c:forEach items="${allbands}" var="item">                
		<tr>
		<td><a href="/lab02-music-portal/music/add_band?id=${item.id}"> <c:out value="${item.id}"/></a></td>
		<td><c:out value="${item.title}"/></td>
		</tr>
		</c:forEach>
	</table>	

</form:form>

<%@ include file="/footer.jsp" %>

